<template>
	<view>
		<!-- 头部 -->
		<view class="toububox">
			<view class="flexbetween" v-if="!is_login" @click="jumpurl('/pages/login/login')">
				<view class="flexleft">
					<view class="touxiang margin_right3">
						<image src="@/static/image/system/weidenglu.png" mode=""></image>
					</view>
					<view class="">
						<view class="dabtext">未登录，点击登录</view>
					</view>
				</view>
				<u-icon name="arrow-right" color="#ffffff" size="20"></u-icon>
			</view>
			<view class="flexbetween" v-if="is_login" @click="jumpurl('/pages/mypage/huiyuanxx')">
				<view class="flexleft">
					<view class="touxiang margin_right3">
						<image :src="userInfo.avatar_text" mode=""></image>
					</view>
					<view class="">
						<view class="dabtext">{{userInfo.nickname}}</view>
						<view class="dabtext margin_top2">会员状态：{{userInfo.level==0?'非会员':'VIP会员'}}</view>
					</view>
				</view>
				<view class="sjbtn" v-if="userInfo.level==0" @click.stop="shengji">升级会员</view>
			</view>
		</view>
		<!-- 内容 -->
		<view class="">
			<view class="mainpadding radius ffffff" style="font-size: 32rpx;">
				<!-- <view class="flexbetween margin_top2 xiahian">
					<view class="nostrongtext">修改应用内昵称和头像</view>
					<u-icon name="arrow-right" color="#333" size="16"></u-icon>
				</view> -->
				<view class="flexbetween xiahian" @click="jumpurl('/pages/mypage/guanfangtz')">
					<view class="">官方通知</view>
					<u-icon name="arrow-right" color="#333" size="16"></u-icon>
				</view>
				<view class="flexbetween margin_top xiahian" @click="wodefw">
					<view class="">消息列表</view>
					<u-icon name="arrow-right" color="#333" size="16"></u-icon>
				</view>
				<view class="flexbetween margin_top xiahian" @click="jumpurl('/pages/mypage/huiyuanxx')">
					<view class="">会员消息</view>
					<u-icon name="arrow-right" color="#333" size="16"></u-icon>
				</view>
				<template v-if="is_login"> 
					<button open-type="share" hover-class="none">
						<view class="flexbetween margin_top xiahian">
							<view class="">推荐分享{{userInfo.share_num?'/'+userInfo.share_num+'次':""}}</view>
							<u-icon name="arrow-right" color="#333" size="16"></u-icon>
						</view>
					</button>
				</template>
				
				<view class="flexbetween margin_top xiahian" @click="jumpurl('/pages/mypage/kefuyijianhz')">
					<view class="">客服/意见/合作</view>
					<u-icon name="arrow-right" color="#333" size="16"></u-icon>
				</view>
				<view class="flexbetween margin_top xiahian"  @click="jumpurl('/pages/system/system?type=3')">
					<view class="">关于小程序</view>
					<u-icon name="arrow-right" color="#333" size="16"></u-icon>
				</view>
				<view class="flexbetween margin_top" @click="jumpurl('/pages/mypage/sheizhi')">
					<view class="">设置</view>
					<u-icon name="arrow-right" color="#333" size="16"></u-icon>
				</view>
			</view>
		</view>
		<view class="wodebgc"></view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				is_login: false,
				userInfo: {},
			}
		},
		onShow() {
			this.is_login = httpRequest.checkIsLogin();
			if (this.is_login) {
				this.init()
			}
		},
		onShareAppMessage: function(options) {
			return {
				title: '维瀚法律',
				imageUrl: '',
				path: '/pages/index/index'
			}
		},
		onShareTimeline: function() {
			return {
				title: '维瀚法律',
				imageUrl: '',
				path: '/pages/index/index'
			}
		},
		methods: {
			onShareAppMessage() {
				this.addshare()
				return {
					title: this.dataAll.ckmj + "㎡" + this.dataAll.ckitem.name,
					path: "/pages/index/cangchuxqxq?id=" + this.listid+ "&invite_code=" + uni.getStorageSync(
						"invite_code"),
				}
			},
			addshare(){
				httpRequest.request('/api/user/userShare', 'GET', {
				}, false, false, true).then(res => {
				})
			},
			wodefw(){
				uni.switchTab({
					url:"/pages/wodefw/wodefw"
				})
			},
			shengji(){
				httpRequest.request('/api/user/userApply', 'GET', {
				}, false, false, true).then(res => {
					httpRequest.toast(res.msg)
				})
			},
			init() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userInfo = res.data
				})
			},
			jumpurl(url){
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/login"
					})
					return false
				}
				uni.navigateTo({
					url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.xiahian {
		padding-bottom: 20rpx;
		border-bottom: 1rpx solid RGBA(112, 112, 112, .04);
	}

	.righticon {
		width: 13rpx;
		height: 13rpx;
		background-image: url('../../static/image/system/righticon.png');
		background-size: 100% 100%;
	}

	.block {
		padding: 50rpx 30rpx 200rpx;
	}


	.sjbtn {
		width: 145rpx;
		height: 44rpx;
		border-radius: 20rpx;
		background-color: #ffa126;
		font-size: 25rpx;
		font-family: AlibabaPuHuiTi;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.wodebgc{
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 400rpx;
		background-image: url("../../static/image/system/mybgc.png");
		background-size: 100% 100%;
		z-index: -10;
	}

	.dabtext {
		font-size: 26rpx;
		font-family: AlibabaPuHuiTi;
		font-weight: 400;
		color: #FFFFFF;
	}

	.touxiang {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;

		image {
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
	}

	.toububox {
		background-color: #9b8d66;
		padding: 150rpx 40rpx 72rpx;
	}
</style>